<?php

namespace App\Services;
use App\Models\WxUsers;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;

class WxUsersService
{
    /**
     * @param $request
     * @return array
     * @name 获取用户信息
     * @user IHammer
     */
    public static function getUserInfoHandle($request){
        /**
         * 采集数据
         */
        $user_id = $request->get("user_id");
        /**
         * 校验数据
         */
        $user = WxUsers::getInfo(['id'=>$user_id]);
        if(empty($user)){
            return [];
        }
        /**
         * 处理数据
         */
        $res['user_id'] = $user['id'];
        $res['nickname'] = $user['nickname'];
        $res['avatarurl'] = $user['avatarurl'];
        $res['mobile'] = $user['mobile'];
        $res['created_at'] = $user['created_at'];
        return  $res;
    }
}